﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Script.Services;
using System.Web.Services;
using System.Web.Script.Serialization;
/// <summary>
/// Summary description for WebService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[ScriptService]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
// [System.Web.Script.Services.ScriptService]
public class WebService : System.Web.Services.WebService
{

    public WebService()
    {

        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }

    [WebMethod]
    public string HelloWorld()
    {
        return "Hello World";
    }
    [ScriptMethod(ResponseFormat = ResponseFormat.Json), WebMethod]
    public string GetExamenData(int page, string name)
    {
        var data = new DataProvider().GetExamenData(page, name);
        return new JavaScriptSerializer().Serialize(data);
    }

    [ScriptMethod(ResponseFormat = ResponseFormat.Json), WebMethod]
    public string GetExamenGroupData(int page, string name)
    {
        var data = new DataProvider().GetExamenGroupData(page, name);
        return new JavaScriptSerializer().Serialize(data);
    }
    [ScriptMethod(ResponseFormat = ResponseFormat.Json), WebMethod]
    public string SaveData(string jsData)
    {
        var data = new DataProvider().SaveData(jsData);
        return new JavaScriptSerializer().Serialize(data);
    }

}
